﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Configuration;

namespace Chapter09_Lesson01
{
    class Program
    {
        static void Main(string[] args)
        {
            Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

            config.AppSettings.Settings.Add(new KeyValueConfigurationElement("testekey", "teste value"));

            config.Save();

            for (int i = 0; i < ConfigurationManager.AppSettings.Count; i++)
            {
                Console.WriteLine("The key is {0} and the value is {1}", ConfigurationManager.AppSettings.AllKeys[i], ConfigurationManager.AppSettings[i]);
            }

            Console.ReadKey();

        }
    }
}
